#include"blockqueue.hpp"
#include<unistd.h>
using namespace Blockqueue;

void* procwork(void * arg)
{
    blockqueue<int>* blqueue = (blockqueue<int>*)arg;
    int i = 1;
    while(1)
    {
        blqueue->product(i);
        ++i;
        sleep(1);
    }
}

void* comswork(void* arg)
{
    blockqueue<int>* blqueue = (blockqueue<int>*)arg;
    int data;
    while(1)
    {
        blqueue->comsume(&data);
        sleep(2);
    }
}

int main()
{   
    pthread_t proc,coms;
    blockqueue<int> blqueue(5);
    pthread_create(&proc,NULL,procwork,(void*)&blqueue);
    pthread_create(&coms,NULL,comswork,(void*)&blqueue);

    pthread_join(proc,NULL);
    pthread_join(coms,NULL);
    return 0;
}

/*
int main()
{
    //std::vector<int> vc(5);
    std::queue<int> queue;
    std::cout<<queue.size()<<std::endl;
    queue.push(1);
    std::cout<<queue.size()<<std::endl;
    queue.pop();
    std::cout<<queue.size()<<std::endl;

    return 0;
}
*/